def find_mod():
    num = input('What is \'e\'? ')
    mod = input('What is the modulus? ')
    istrue = False
    dkey = 1
    while istrue == False:
        if (num ** dkey) % mod == 1:
            return dkey
        else:
            dkey += 1

print find_mod()
